from pymysql import Connection

# 获取Mysql数据库连接对象
conn = Connection(host="localhost", port=3306, user="root", password="password")

print(conn.get_server_info())

# 获取游标对象
cursor = conn.cursor()
# 选择数据库
conn.select_db("mytest")
# 使用游标对象执行sql语句
cursor.execute("SELECT * FROM test_pymysql")
# 获取查询结果
results: tuple = cursor.fetchall()
for row in results:
    print(type(row))
    print(row)
# 关闭连接
conn.close()
